Skip to content

fix: convert incorrect breadcrumb links to opaque spans #7626

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

dario-piotrowicz
Copy link
Member

Description

It's pretty minor but I figured I could just open a PR to fix this small UI bug I noticed 🙂

The fact is that in pages with breadcrumbs at the bottom of the screen most of the time the first breadcrumbs link is not really a valid link and clicking it results in a hard reload of the app:

See:
issue

My changes here make breadcrumb items with falsy hrefs simple text elements instead of a links, for good measure they are also dimmed to make it more evident that they are not clickable

Validation

I manually validated this check with npm run dev and also npm run build && npm run start

Check List

  • I have read the Contributing Guidelines and made commit messages that follow the guideline.
  • I have run npm run format to ensure the code follows the style guide.
  • I have run npm run test to check if all tests are passing.
  • I have run npx turbo build to check if the website builds without errors.
  • I've covered new added functionality with unit tests if necessary.

@Copilot Copilot AI review requested due to automatic review settings April 6, 2025 23:39
@dario-piotrowicz dario-piotrowicz requested a review from a team as a code owner April 6, 2025 23:39
Copy link

vercel bot commented Apr 6, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
nodejs-org ✅ Ready (Inspect) Visit Preview Apr 7, 2025 0:31am

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

@avivkeller
Copy link
Member

Can you add a linkless story?

Copy link
Contributor

github-actions bot commented Apr 6, 2025

Lighthouse Results

URL Performance Accessibility Best Practices SEO Report
/en 🟢 99 🟢 100 🟢 100 🟢 91 🔗
/en/about 🟢 100 🟢 100 🟢 100 🟢 91 🔗
/en/about/previous-releases 🟢 99 🟢 100 🟢 100 🟢 92 🔗
/en/download 🟢 96 🟢 100 🟢 100 🟢 91 🔗
/en/blog 🟢 100 🟢 100 🟢 96 🟢 92 🔗

Copy link
Contributor

github-actions bot commented Apr 6, 2025

Unit Test Coverage Report

Title Lines Statements Branches Functions
@node-core/ui-components Coverage: 95%
95.83% (161/168) 77.86% (102/131) 88.57% (31/35)
@nodejs/website Coverage: 87%
84.73% (494/583) 76.03% (165/217) 86.99% (107/123)
Title Tests Skipped Failures Errors Time
@node-core/ui-components 24 0 💤 0 ❌ 0 🔥 5.178s ⏱️
@nodejs/website 156 0 💤 0 ❌ 0 🔥 6.564s ⏱️

@dario-piotrowicz
Copy link
Member Author

Can you add a linkless story?

Thanks for the suggestion 🙂

Sure, done 🙂👍

@dario-piotrowicz
Copy link
Member Author

dario-piotrowicz commented Apr 7, 2025

mh... actually I might need to amend something, the last item should be styled as active even if it doesn't have an href right? 🤔

Screenshot at 2025-04-07 01-23-44

The About Node.js breadcrumb item should be styled as active, right? 🤔

@dario-piotrowicz
Copy link
Member Author

mh... actually I might need to amend something, the last item should be styled as active even if it doesn't have an href right? 🤔

addressed 👍 614899a (the solution is a bit ugly but I am not sure if much better can be done here 🤔)

Copy link
Member

@ovflowd ovflowd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is weird. All breadcrumb entries should be links. The fact that About Node.js is causing a hard refresh is a bug.

We shouldn't do this; we should investigate why the link wasn't a link to begin with.

@dario-piotrowicz
Copy link
Member Author

why the link wasn't a link to begin with.

It's because of the site navigation structure, for example see:

Screenshot at 2025-04-07 10-50-00

Screenshot at 2025-04-07 10-51-12

there is actually no getting started page (see: https://nodejs.org/en/learn/getting-started/)

so if the breadcrumb for getting started were a link what page would it point to?

@ovflowd
Copy link
Member

ovflowd commented May 2, 2025

Right, but I do have the feeling that something else is at play here 🤔 like all these breadcrumbs should link to actual pages. They should correlate to something within the tree of the path structure. So something could be borken on the breadcrumb generation.

@dario-piotrowicz
Copy link
Member Author

Right, but I do have the feeling that something else is at play here 🤔 like all these breadcrumbs should link to actual pages. They should correlate to something within the tree of the path structure. So something could be borken on the breadcrumb generation.

mh... I feel like this is a UI/design issue more than a code related one, so if we again take https://nodejs.org/en/learn/getting-started/differences-between-nodejs-and-the-browser as an example and you look at the breadcrumbs at the bottom, what do you think they should look like? should Getting Started be there? (since this page is part of the getting starter section) or shouldn't it be there? (since there is no page for that specific section).

If Getting Started should be there, maybe a new /getting-started route/page should added to make the breadcrumbs' link can point to a real page?

I feel like we first need to answer these design questions before we can agree/understand if there's something actually wrong with the code

@ovflowd
Copy link
Member

ovflowd commented May 4, 2025

If Getting Started should be there, maybe a new /getting-started route/page should added to make the breadcrumbs' link can point to a real page?

We should make the first article of getting-started also be available under /getting-started, that could fix this issue (we can make internal redirects on redirects.json) wdyt?

Copy link
Member

@ovflowd ovflowd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@ovflowd
Copy link
Member

ovflowd commented May 4, 2025

If Getting Started should be there, maybe a new /getting-started route/page should added to make the breadcrumbs' link can point to a real page?

We should make the first article of getting-started also be available under /getting-started, that could fix this issue (we can make internal redirects on redirects.json) wdyt?

We can open a follow-up issue for this if you feel like?

@dario-piotrowicz
Copy link
Member Author

We should make the first article of getting-started also be available under /getting-started, that could fix this issue (we can make internal redirects on redirects.json) wdyt?

I did try something like that and it worked pretty ok however this was a bit awkward in the first article since the link there would point to the exact same page, so let's take https://nodejs.org/en/learn/getting-started/introduction-to-nodejs there you'd have:
Screenshot at 2025-05-04 14-06-16

where the last two breadcrumb links would point to the exact same page, which is not the end of the world but if does feel pretty awkward to me 🤔

@dario-piotrowicz
Copy link
Member Author

We can open a follow-up issue for this if you feel like?

Sorry but I feel like the solution here and what you're suggesting are not really compatible (we either do make the breadcrumb a valid working link or make it not a link at all, I don't think that we can apply both).

If you prefer your solution I am totally happy to just close this PR and open a new one with that solution instead 🙂 (however please do keep in mind my comment above)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants